package com.mall.module.system.domain.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

@ApiModel("后台用户注册参数")
@Data
public class RegisterDto {

    @ApiModelProperty(value = "用户名", required = true, example = "admin")
    @NotBlank(message = "用户名不能为空")
    @Size(min = 4, max = 20, message = "用户名长度需在4-20字符之间")
    private String username;

    @ApiModelProperty(value = "密码", required = true, example = "P@ssw0rd123")
    @NotBlank(message = "密码不能为空")
    @Pattern(
        regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d@$!%*?&]{6,32}$",
        message = "密码需6-32位字符，必须包含字母和数字"
    )
    private String password;

    @ApiModelProperty(value = "用户头像URL", example = "https://example.com/avatar.png")
    private String icon;

    @ApiModelProperty(value = "邮箱", example = "user@example.com")
    @Email(message = "邮箱格式不合法")
    private String email;

    @ApiModelProperty(value = "手机号", example = "13800138000")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不合法")
    private String mobile;

    @ApiModelProperty(value = "用户昵称", example = "系统管理员")
    @Size(max = 30, message = "昵称长度不能超过30字符")
    private String nickName;
}
